package com.ciwong.epaper.modules.me.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ciwong.epaper.R;
import com.ciwong.epaper.modules.me.bean.MoreItemBean;

import java.util.List;

/**
 * Created by 纵约长 on 2017/6/2.
 */

public class MoreItemAdapter extends BaseCommonAdapter<MoreItemBean> {

    public MoreItemAdapter(List<MoreItemBean> dataList) {
        super(dataList);
    }

    @Override
    public int getItemResId(int position) {
        return R.layout.item_more;
    }

    @Override
    public Object createViewHolder(View convertView, int position) {
        ViewHolder viewHolder = new ViewHolder();
        viewHolder.iv_more_icon = (ImageView) convertView.findViewById(R.id.iv_more_icon);
        viewHolder.tv_more_title = (TextView) convertView.findViewById(R.id.tv_more_title);

        return viewHolder;
    }

    @Override
    public void showData(MoreItemBean bean, Object holder, int position) {
        ViewHolder viewHolder = (ViewHolder) holder;
        viewHolder.tv_more_title.setText(bean.title);
        viewHolder.iv_more_icon.setBackgroundResource(bean.iconResId);

    }

    public class ViewHolder {
        public ImageView iv_more_icon;
        public TextView tv_more_title;
    }
}
